<?php
require $this->__RAD__ . 'component/global/head.php';
?>
<body>
<?php
require $this->__RAD__ . 'component/global/header.php';
require $this->__RAD__ . 'component/global/headerEnd.php';
?>

<div class="public-menu">
    <div class="menu-list">
        <div class="swiper-wrapper">
            <?php
            if ($this->type) :
                foreach ($this->type as $val) :
                    ?>
                    <div class="swiper-slide"><a href="/product/list/<?= $val->product_fication_id ?>"><?= $val->fication_name ?></a></div>
                    <?php
                endforeach;
            endif;
            ?>
        </div>
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
    </div>
</div>
<hr/>
<div class="wrapper">
<div class="photo-show">
    <div class="photo-left fl">
	    <a onclick="return false;" href='<?= $this->__CDN__ ?>pics/l/<?= $this->product->cover ?>' class="big-img" style="display:block;width:564px;position:relative;" >
		    <img src="<?= $this->__CDN__ ?>pics/l/<?= $this->product->cover ?>" width="564" height="auto"  />
	    </a>
    </div>
    <div class="photo-right fr">
        <p>图片名：<?= $this->product->title ?></p>
        <p>图片编号：<?= $this->product->img_sn ?></p>
        <p>图片格式：<?= $this->product->format ?></p>
        <?php
        if ($this->product->img_size) :
            ?>
            <p>图片尺寸：<?= $this->product->img_size ?></p>
            <?php
        endif;
        ?>
        <?php
        if ($this->product->power) :
            ?>
            <p>分辨率：<?= $this->product->power ?></p>
            <?php
        endif;
        ?>
        <p>上传日期：<?= date('Y年m月d日', $this->product->upload_date) ?></p>
        <p>方式：<?= $this->product->mode ?></p>
<!--        <p>版权所有：上海艺栢品牌管理有限公司</p>-->
        <p>版权所有：<?= $this->product->copyright ?></p>
        <?php
        if ($this->product->label) :
            ?>
            <p>标签：<?= $this->product->label ?></p>
            <?php
        endif;
        ?>
        <?php
        if ($this->product->synopsis) :
        ?>
        <p>作品描述：<?= $this->product->synopsis ?></p>
        <?php
        endif;
        ?>
        <span>确权唯一标识码：<?= $this->product->serialNumber ?></span>
        <br class="clear" />
        <a class="click-product" href="javascript:;">购买</a>
        <a id="download-img" class="click-product" href="javascript:;">下载</a>
        <a id="collection-btn" class="collect click-product" href="javascript:;">收藏</a>
        <a id="download-book" href="javascript:;"  class="click-product">下载授权书</a>
    </div>
    <br class="clear" />
</div>
</div>
<?php
require $this->__RAD__ . 'component/global/collection.php';
require $this->__RAD__ . 'component/global/footer.php';
?>

</body>
<script>
    $('.click-product').click(function () {
        alert(
            '请到正式网站购买下载'
        );
        return false;
    })
</script>
<script type="text/javascript">
    $('.noBuyOrder').click(function () {
       alert('您尚未购买此图片，需购买后才可下载');
       return false;
    });
    layui.use('layer',function(){
        var layer = layui.layer , $ = layui.jquery;

        $(document).on('click','.collect-add-btn',function(){
            collect = layer.open({
                type:1,
                title:false,
                closeBtn:false,
                area:["auto","auto"],
                content:$('.collect-data-add'),
            })
        })
        $('.collect-data-add .close, .collect-data-cancel').click(function(){
            layer.close(collect);
        })
        $('.collect-data-add-a').click(function () {
            var collect = $('.collect-data-info-input').val();
            var id = $('.collect-data-info-input').attr('data-id');
            if (collect != '') {
//                测试关闭底部图层的
//                alert('添加收藏夹成功');
//                findCollection('新建文件夹', '');
//                $('.collect-data-add .close, .collect-data-cancel').click(function(){
//                    layer.close(collect);
//                })
//                $('.collect-data-cancel').click();
                $.post('/api/addFolder', {title : collect, id : id},
                    function(data) {
                        data = eval("(" + data + ")");
                        console.log(data.errcode);
                        switch (data.errcode) {
                            case 0 :
                                alert('添加收藏夹成功');
                                findCollection('新建文件夹', '');
                                $('.collect-data-add .close, .collect-data-cancel').click(function(){
                                    layer.close(collect);
                                })
                                $('.collect-data-cancel').click();
                                break;
                            default:
                                alert(data.errmsg);
                                break;
                        }
                    })
            } else {
                alert('请输入收藏夹名字');
                return false;
            }
        })
        // var _imgw=;
        // var _imgh=$(".big-img img").height();
        // console.log(_imgw);
        // console.log(_imgh);
        document.onreadystatechange=piczoom();
        function piczoom(){
//            setTimeout(function(){
                $(".big-img").enlarge({
                    // 鼠标遮罩层样式
                    shadecolor: "#FFD24D",
                    shadeborder: "#FF8000",
                    shadeopacity: 0.5,
                    cursor: "move",

                    // 大图外层样式
                    layerwidth: $(".big-img img").width()/1.1,
                    layerheight: $(".big-img img").height()/1.1,
                    //layerwidth: 564,
                    //layerheight: 426,
                    layerborder: "#DDD",
                    fade: true,

                    // 大图尺寸
                    largewidth: $(".big-img img").width()*3,
                    largeheight: $(".big-img img").height()*3
                });
//            },500)
        }


        $('.photo-left').hover(function(){
            if($(this).hasClass('hover')){

            }
            else{
                $(this).addClass('hover');
                var isFirst = true;
                if(isFirst){
                    piczoom();
                    console.log(1);
                    isFirst = false;
                }
            }

        });

    })
</script>
</html>
